﻿
Public Class Metrics

    Private apiBridge As Bridge
    Private filterByPersonnelResolved As IEnumerable(Of XElement)

    Public Sub New(ByVal bridge As Bridge)
        apiBridge = bridge
    End Sub


    Private Function getListOfCasesToPrint(ByVal ixFixFor As String) As IEnumerable(Of XElement)

        Dim xml = apiBridge.Search("ixFixFor=" & ixFixFor & "&cols=ixBugParent,ixBugChildren,Tags,sCategory,sProject,sTitle,sLatestTextSummary,hrsCurrEst")

        Return From element In xml...<case> Select element

    End Function

    Private Function getListOfFixFors() As IEnumerable(Of XElement)

        Return apiBridge.RunCommand("cmd=listFixFors")...<fixfor>.ToList()

    End Function

    Public Function GetIterations() As IEnumerable(Of List(Of Iteration))
        Return From element In getListOfFixFors...<fixfor> _
               Select New Iteration With {.Id = element.<ixFixFor>.Value, .Name = element.<sFixFor>.Value}
    End Function

End Class
